package com.pi.shisan.diy;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

import java.util.Objects;

@SpringBootApplication
@ComponentScan({"com.pi.shisan.web","com.pi.shisan.service","com.pi.shisan.diy"})
@MapperScan("com.pi.shisan.service.mapper")
public class Run extends Application {

    private static Stage stage;

    @Override
    public void start(Stage primaryStage) throws Exception {
        stage = primaryStage;
        Parent parent = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/index.fxml")));
        parent.getStylesheets().add(Objects.requireNonNull(getClass().getResource("/css/toggleButton.css")).toExternalForm());
        Scene scene = new Scene(parent);
        primaryStage.setScene(scene);
        primaryStage.setWidth(800);
        primaryStage.setHeight(600);
        primaryStage.show();
    }

    public static Stage getStage() {
        return stage;
    }

    public static void start(String[] args) {
        launch(args);
    }
}
